package com.hospital.hospitalserver.controller;

import com.hospital.hospitalserver.entity.PatientVisitDTO;
import com.hospital.hospitalserver.entity.PaymentOrderDTO;
import com.hospital.hospitalserver.service.ExamOrderService;
import com.hospital.hospitalserver.service.PatientVisitService;
import com.hospital.hospitalserver.util.Response;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

/**
 * 自助缴费机 - 缴费功能
 * */
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/selfPayment")
public class SelfPaymentController {
    private final PatientVisitService patientVisitService;
    private final ExamOrderService examOrderService;

    /**
     * 验证挂号编码后跳转下一个页面
     * */
    @PostMapping("/validateRegistrationCode")
    public Response validateRegistrationCode(@RequestBody PatientVisitDTO request){
        return patientVisitService.validatePatientVisitAppointmentId(request);
    }

    /**
     * 自助缴费功能1
     * 根据挂号编号获取患者基础信息及费用明细
     * */
    @PostMapping("/getPatientFeeDetailsByRegNo")
    public Response getPatientFeeDetailsByRegNo(@RequestBody PatientVisitDTO request){
        return Response.success();
    }

    /**
     * 自助缴费功能2
     * 根据有效的挂号凭证ID查询当前诊断记录相关的检查项目
     * */
    @PostMapping("/getExamOrderItemListByVisit")
    public Response getExamOrderItemListByVisit(@RequestBody PatientVisitDTO request){
        return examOrderService.getExamOrderItemListByVisit(request);
    }

    /**
     * 自助缴费功能3
     * 进行缴费 - 这里模拟支付不涉及具体的支付金额扣除操作，只针对当前系统进行操作
     * */
    @PostMapping("/completePayment")
    public Response completePayment(@RequestBody PaymentOrderDTO request){
        return examOrderService.completeExamOrderPayment(request);
    }
}
